#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
#include<vector>
#include<string>
using namespace std;

class Solution {
public:
    static int lengthOfLongestSubstring(string s)
    {
        int hash[1000] = { 0 };
        int maxlen = 0;
        for (int begin = 0, end = 0; end < s.size(); end++)
        {
            hash[s[end]]++;
            while (hash[s[end]] > 1) hash[s[begin++]]--;
            maxlen = max(maxlen, end - begin + 1);
        }
        return maxlen;
    }
};
int main()
{
    cout << Solution::lengthOfLongestSubstring("ABCABCABC") << endl;
	return 0;
}